<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
    <script type="text/javascript" src="javascripts/jquery.min.js"></script>
    <script type="text/javascript">
    	function save() {  
    		let rowsData = [{
    			// id:7,
    			// original_order_id:6,
	    		internal_trade_id:5,
	    		internal_trade_name:'菜籽油',
	    		internal_type_id:5,
	    		internal_type_name:'粮油类',
	    		unit_price:30,
	    		unit_name:'桶',
	    		amount:5,
	    		total_price:150
	    	},{
	    		// id:8,
    			// original_order_id:6,
	    		internal_trade_id:1,
	    		internal_trade_name:'苹果',
	    		internal_type_id:1,
	    		internal_type_name:'水果类',
	    		unit_price:5,
	    		unit_name:'元/斤',
	    		amount:10,
	    		total_price:50
	    	}];

    		let submitData = new Object();
    		submitData.rows = new Array();
    		// submitData.id = 10;
			submitData.distribution_date = '2017-11-20';
			submitData.customer_unit_id = 2;
			submitData.customer_unit_name = '资江有限公司';
			submitData.customer_group_name = '游仙区';
			submitData.is_verify = 0;
			submitData.print_count = 0;
			submitData.total = 200.00;
			submitData.status = '配送中';
			submitData.rows = rowsData;

			submitData = JSON.stringify(submitData);
		    $.ajax({  
		        url: 'http://192.168.199.196:3000/logistics/originalorder/add',  
		        type: 'post',  
		        data: 'a='+submitData, 
		        dataType: 'JSON',  
		        success: function (data) {  
		            console.log(data);  
		        },  
		        error: function (err) {  
		            console.log(err);  
		        }  
		    });  
		}

		function basicTest(){
			let _data = new Object();
			_data.pinyinname = 'bg';
			// _data.id = 2;
			_data = JSON.stringify(_data);
			$.ajax({  
		        url: 'http://192.168.199.196:3000/basic/internaltrade/findbypinyin',  
		        type: 'post',  
		        data: 'a='+_data, 
		        dataType: 'JSON',  
		        success: function (data) {  
		            console.log(data);  
		        },  
		        error: function (err) {  
		            console.log(err);  
		        }  
		    });  
		}
    </script>
</head>
<body>
	<button onclick="save()">原始订单测试</button>
	<button onclick="basicTest()">基础信息测试</button>
</body>
</html>
